"""
URL configuration for chat_widget_dj project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, re_path, include
from django.views.generic import TemplateView
from django.views.static import serve
from django.conf import settings
from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)
# dfw文档
from rest_framework.documentation import include_docs_urls

from django.contrib.staticfiles.urls import staticfiles_urlpatterns

urlpatterns = [
    path('', TemplateView.as_view(template_name="dist/index.html")),
    # dfw配置
    re_path(r'^api-auth/', include('rest_framework.urls')),
    # dfw文档
    path('docs/', include_docs_urls(title='API文档')),
    # 静态文件夹存放目录配置
    re_path("^media/(?P<path>.*)$", serve, {"document_root": settings.MEDIA_ROOT, }),
    # jwt的认证接口
    path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    # ckeditor编辑器
    path('ckeditor5/', include('django_ckeditor_5.urls')),
    # 管理后台入口配置
    path('admin/', admin.site.urls),
    # 用户
    path('users/', include('apps.users.urls', namespace='users')),
    # AI聊天
    path('llm/', include('apps.chatLLM.urls', namespace='chatLLM')),
]

# ... the rest of your URLconf goes here ...
urlpatterns += staticfiles_urlpatterns()

# admin.site.register(Desgin)
admin.site.site_header = 'AI助手管理后台'  # admin头名称
admin.site.site_title = 'AI助手管理后台'
